//Wed May 12 05:51:08 CDT 2010
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class JingleRingle
{
public:
	int profit(vector<int> buyOffers, vector<int> sellOffers, int tax)
	{
		sort(buyOffers.begin(), buyOffers.end());
		sort(sellOffers.begin(), sellOffers.end());
		int N = buyOffers.size();
		int M = sellOffers.size();
		int sum = 0;
		for (int i = N - 1, j = 0; j < M && i >= 0; i--, j++)
		{
			int taxpay = (int) floor(1.0 * buyOffers[i] * tax / 100);
			if (buyOffers[i] - sellOffers[j] - taxpay > 0)
				sum += buyOffers[i] - sellOffers[j] - taxpay;
			else
				cout << buyOffers[i] << ", " << sellOffers[j] << endl;

		}
		return sum;
	}
};
